function [likel,ssvec,flag_ok,lht]=likelNSplits(parest,parvec,parposest,funcmod,Y,trainvec,solveopt,addsol)
% =========================================================================
%% LikelNanReg.m
%
% This code estimates the likelihood of a 
% 1) NaN model 
% 2) Without Mixed Frequency 
% 3) Regular, i.e. NO Split in matrices
%
% [GG, RR, CONS, eu, SDX, ZZ, initss, ssvec, flag, ssnames]=feval(funcmod,param,options,addsol);
%
% =========================================================================
%% Initialize parameters
likel=-1e20; flag_ok=0;
parvec(parposest)=parest;
%% Model solution, second sample stored in structure second (second sample)
[G,R,C,eu,SDX,Z,structOne,ssvec,structTwo]=feval(funcmod,parvec,solveopt,addsol);
if ~isequal(eu,[1;1])
    lht=[]; 
    return 
end 
[T,ny]=size(Y);
Y = Y';
%% Initialization
pshat=feval(@lyapunov_symm,G(:,:,addsol.tauVec(1)),...
    R(:,:,addsol.tauVec(1))*(SDX(:,:,addsol.tauVec(1))')*...
    SDX(:,:,addsol.tauVec(1))*(R(:,:,addsol.tauVec(1))'));
shat       =zeros(size(G,1),1);
lht        =zeros(T,1);
for ii=1:T;
    [shat,pshat,lht(ii)]=feval(@kf,( Y(:,ii)-Z(:,:,addsol.tauVec(ii))*C(:,addsol.tauVec(ii)) ),...
        Z(:,:,addsol.tauVec(ii)),shat,pshat,G(:,:,addsol.tauVec(ii)),R(:,:,addsol.tauVec(ii))*(SDX(:,:,addsol.tauVec(ii))'));
end
%% Likelihood plus integration constant
%disp(sprintf('Likel Before Estimation %10.4f',lht(trainvec(1)-1))); 
lht   = lht(trainvec(1):trainvec(2));
likel = -0.5*(length(lht)*ny)*log(2*pi)+sum(lht);
flag_ok=1;
%% End of File
end